<template>
  <div>
    <el-button @click="onSubmit" type="primary">立即创建</el-button>
    <el-button @click="reset">重 置</el-button>
  </div>
</template>
<script>
export default {
  props: {
    formData: Object,
    XForm: Object
  },
  methods: {
    onSubmit () {
      this.XForm.validate(valid => { // 调用 XForm 的表单校验方法
        if (!valid) {
          this.$message.warning('请完善表单信息')
          return false
        }
        this.$emit('onSubmit')
      })
    },
    reset () {
      this.XForm.resetFields()
      this.$emit('reset')
    }
  }
}
</script>
